/*
 Navicat Premium Data Transfer

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 80030 (8.0.30)
 Source Host           : 127.0.0.1:3306
 Source Schema         : seckills

 Target Server Type    : MySQL
 Target Server Version : 80030 (8.0.30)
 File Encoding         : 65001

 Date: 14/09/2022 20:06:50
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `goods_name` varchar(255) NOT NULL COMMENT '商品名称',
  `goods_title` varchar(200) DEFAULT NULL COMMENT '商品标题',
  `goods_img` varchar(200) DEFAULT NULL COMMENT '商品图片',
  `goods_detail` longtext COMMENT '商品详情',
  `goods_price` decimal(10,2) DEFAULT '0.00' COMMENT '商品价格',
  `goods_stock` int NOT NULL DEFAULT '0' COMMENT '商品库存 -1表示无限制',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of goods
-- ----------------------------
BEGIN;
INSERT INTO `goods` (`id`, `goods_name`, `goods_title`, `goods_img`, `goods_detail`, `goods_price`, `goods_stock`) VALUES (1, 'iphone14', 'iphone最新款 至尊', 'https://img14.360buyimg.com/n0/jfs/t1/161449/30/30275/18502/63191e27Efbe6561b/38f985c3d3bcaed0.jpg.avif', 'iphone14 iphone2022发行', 8999.00, 1000);
INSERT INTO `goods` (`id`, `goods_name`, `goods_title`, `goods_img`, `goods_detail`, `goods_price`, `goods_stock`) VALUES (2, 'iphone13', 'Apple iPhone 13 Pro (A2639) 128GB 金色 支持移动联通电信5G 双卡双待手机', 'https://img14.360buyimg.com/n0/jfs/t1/118595/5/21737/36937/6231b0a7Ecfb08147/c338b2c120fc2831.jpg.avif', '金色', 7999.00, 2000);
COMMIT;

-- ----------------------------
-- Table structure for seckill_goods
-- ----------------------------
DROP TABLE IF EXISTS `seckill_goods`;
CREATE TABLE `seckill_goods` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '秒杀商品id',
  `goods_id` bigint DEFAULT NULL COMMENT '商品id',
  `seckill_price` decimal(10,2) DEFAULT NULL COMMENT '秒杀价格',
  `stock_count` bigint DEFAULT NULL COMMENT '秒杀库存',
  `start_date` datetime DEFAULT NULL COMMENT '秒杀开始时间',
  `end_date` datetime DEFAULT NULL COMMENT '秒杀结束时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of seckill_goods
-- ----------------------------
BEGIN;
INSERT INTO `seckill_goods` (`id`, `goods_id`, `seckill_price`, `stock_count`, `start_date`, `end_date`) VALUES (1, 1, 5000.00, 2, '2022-09-14 15:16:20', '2022-09-14 16:17:36');
INSERT INTO `seckill_goods` (`id`, `goods_id`, `seckill_price`, `stock_count`, `start_date`, `end_date`) VALUES (2, 2, 4000.00, 100, '2022-09-13 10:48:34', '2022-09-14 15:48:40');
COMMIT;

-- ----------------------------
-- Table structure for seckill_order
-- ----------------------------
DROP TABLE IF EXISTS `seckill_order`;
CREATE TABLE `seckill_order` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `order_id` bigint DEFAULT NULL COMMENT '订单id',
  `user_id` bigint DEFAULT NULL COMMENT '用户id',
  `goods_id` bigint DEFAULT NULL COMMENT '商品id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of seckill_order
-- ----------------------------
BEGIN;
INSERT INTO `seckill_order` (`id`, `order_id`, `user_id`, `goods_id`) VALUES (1, 0, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for t_order
-- ----------------------------
DROP TABLE IF EXISTS `t_order`;
CREATE TABLE `t_order` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT '用户id',
  `goods_id` bigint NOT NULL COMMENT '商品id',
  `delivery_addr_id` bigint NOT NULL COMMENT '收货地址id',
  `goods_name` varchar(255) NOT NULL COMMENT '商品名称 冗余',
  `goods_count` bigint NOT NULL COMMENT '商品数量',
  `goods_price` decimal(10,2) NOT NULL COMMENT '商品单价 冗余',
  `order_channel` varchar(2) NOT NULL COMMENT '1:pc 2:android 3:ios 4:H5',
  `status` varchar(2) NOT NULL COMMENT '订单状态 0新建未支付  1 已支付 2已发货 3已收货 4已退款  5已完成',
  `create_date` datetime DEFAULT NULL,
  `pay_date` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of t_order
-- ----------------------------
BEGIN;
INSERT INTO `t_order` (`id`, `user_id`, `goods_id`, `delivery_addr_id`, `goods_name`, `goods_count`, `goods_price`, `order_channel`, `status`, `create_date`, `pay_date`) VALUES (5, 1, 1, 0, 'iphone14', 1, 5000.00, 'H5', '0', '2022-09-14 16:04:59', '2022-09-14 16:04:59');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `phone_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '手机号',
  `nickname` varchar(20) NOT NULL COMMENT '用户名',
  `password` varchar(40) NOT NULL COMMENT '密码:md5(md5(pass明文+salt)+salt)',
  `slat` varchar(32) NOT NULL COMMENT '盐值',
  `head` varchar(128) NOT NULL COMMENT '头像',
  `register_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '注册时间',
  `last_login_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后一次登录时间',
  `login_count` int NOT NULL DEFAULT '0' COMMENT '登录次数',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `phone_number`, `nickname`, `password`, `slat`, `head`, `register_date`, `last_login_date`, `login_count`) VALUES (1, '18321584034', 'wuxf', 'e39cf588e5fcce89527e13f1d7a07124', '123b9760945e4c04a062bbc3c8fb5492', '-', '2022-09-02 10:46:28', '2022-09-02 10:46:28', 0);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
